package com.systop.common.modules.security.user;

import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import com.systop.common.modules.security.acegi.resourcedetails.ResourceDetails;
import com.systop.core.Constants;

/**
 * 用户管理及相关模块的常量类
 * 
 * @author Sam Lee
 * 
 */
public final class UserConstants {
	
	/** 在Web目录下存放照片的路径 */
	public static final String USER_PHOTO_PATH = "/uploaded/user/photo/";
	
	/** 权限操作－URL */
	public static final String PERMISSION_OPERATION_URL = "target_url";
	
	/** 权限操作－函数 */
	public static final String PERMISSION_OPERATION_FUNC = "target_function";
	
	public static final String ADMIN = "admin";
	
	public static final String ADMIN_NAME = "管理员";
	
	public static final String ADMIN_PASS = "manager";
	
	/**
	 * 系统管理员角色
	 */
	public static final String ROLE_ADMIN = "ROLE_ADMIN";
	
	public static final String ROLE_GENERAL = "ROLE_GENERAL";
	
	/**
	 * 用户状态－可用
	 */
	public static final String USER_STATUS_USABLE = Constants.YES;
	
	/**
	 * 用户状态－禁用
	 */
	public static final String USER_STATUS_DISABLE = Constants.NO;
	
	/**
	 * 性别常量，M-男性
	 */
	public static final String GENT = "M";

	/**
	 * 性别常量，F-女性
	 */
	public static final String LADY = "F";

	/**
	 * 权限操作列表
	 */
	public static final Map<String, String> PERMISSION_OPERATIONS = Collections
			.synchronizedMap(new HashMap<String, String>());
	static {
		PERMISSION_OPERATIONS.put(PERMISSION_OPERATION_FUNC, "函数权限");
		PERMISSION_OPERATIONS.put(PERMISSION_OPERATION_URL, "URL权限");
	}

	/**
	 * 性别常量Map
	 */
	public static final Map<String, String> SEX_MAP = Collections
			.synchronizedMap(new LinkedHashMap<String, String>());
	static {
		SEX_MAP.put(GENT, "男");
		SEX_MAP.put(LADY, "女");
	}

	/**
	 * 用户类别Map
	 */
	public static final Map<String, String> TYPE_MAP = Collections
			.synchronizedMap(new LinkedHashMap<String, String>());
	static {
		TYPE_MAP.put(Constants.NO, "职员");
		TYPE_MAP.put(Constants.YES, "负责人");
	}
	
	/**
	 * URL资源
	 */
	public static final String RESOURCE_TYPE_URL = ResourceDetails.RES_TYPE_URL;

	/**
	 * 函数资源
	 */
	public static final String RESOURCE_TYPE_FUNCTION = ResourceDetails.RES_TYPE_FUNCTION;

	/**
	 * 权限操作列表
	 */
	public static final Map<String, String> RESOURCE_TYPES = Collections
			.synchronizedMap(new HashMap<String, String>());
	static {
		RESOURCE_TYPES.put(RESOURCE_TYPE_URL, "URL资源");
		RESOURCE_TYPES.put(RESOURCE_TYPE_FUNCTION, "函数资源");
	}

	/**
	 * 防止实例化
	 */
	private UserConstants() {
	}
}
